From 54a62a3ff06fc132b3ea8506efbce06c5e0869fe Mon Sep 17 00:00:00 2001
From: Owen Jacobson <owen@grimoire.ca>
Date: Sat, 12 Oct 2024 14:02:16 -0400
Subject: Initial invite accept UI

---
 ui/routes/(login)/invite/[invite]/+page.svelte | 28 ++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 ui/routes/(login)/invite/[invite]/+page.svelte

(limited to 'ui/routes/(login)/invite/[invite]/+page.svelte')

diff --git a/ui/routes/(login)/invite/[invite]/+page.svelte b/ui/routes/(login)/invite/[invite]/+page.svelte
new file mode 100644
index 0000000..eea05fc
--- /dev/null
+++ b/ui/routes/(login)/invite/[invite]/+page.svelte
@@ -0,0 +1,28 @@
+<script>
+    import { goto } from '$app/navigation';
+    import { page } from '$app/stores';
+    import { acceptInvite } from '$lib/apiServer';
+
+    $: inviteId = $page?.params?.invite;
+    $: invite = $page.data;
+
+    import LogIn from '$lib/components/LogIn.svelte';
+
+    let disabled;
+    let username;
+    let password;
+
+    async function onSubmit() {
+        disabled = true;
+        const response = await acceptInvite(inviteId, username, password);
+        if (200 <= response.status && response.status < 300) {
+            username = '';
+            password = '';
+            goto('/');
+        }
+        disabled = false;
+    }
+</script>
+
+<p>Hi there! {invite.issuer.name} invites you to the conversation.</p>
+<LogIn bind:disabled bind:username bind:password on:submit={onSubmit} />
-- 
cgit v1.2.3

